import axios from '@/libs/request/axios'
import {getUri} from "@/libs/tools";
//申请编号和业务场景获取影像类型情况
export const getUploadList = (initParam,path='',config) => {
    return axios.request({
        url: `/${path==''?getUri('image'):path}${config||'/upload/getUploadListByGroup'}`,
        data: initParam,
        method: 'post'
    })
}
//申请编号和业务场景获取影像类型情况
export const uploadFile = (attachmentId,attachmentName,fileType,fileName,fileMd5,applyNo,belongNo,path='',config) => {
    let url = `/${path==''?getUri('image'):path}${config || '/upload/saveAttachmentFile'}`
    return axios.request({
        url,
        params: {
            attachmentId:attachmentId,
            attachmentName:attachmentName,
            fileType:fileType,
            fileName:fileName,
            fileMd5:fileMd5,
            applyNo:applyNo,
            belongNo:belongNo
        },
        method: 'post'
    })
}
// /
export const saveAttachmentFile = (data,path='',config) => {
    let url = `/${path==''?getUri('image'):path}${config||'/upload/saveAttachmentFile'}`
    return axios.request({
        url,
        params: data,
        method: 'post'
    })
}
//影像件类型获取最新的图片
export const showFile = (initParam,path='') => {
    return axios.request({
        url:`/${path==''?getUri('image'):path}/upload/viewFile`,
        data:initParam,
        method: 'post'
    })
}

//更新图片信息
export const updateFile = (fileParam,path='',config) => {
    let url = `/${path==''?getUri('image'):path}${config||'/upload/updateFile'}`
    return axios.request({
        url,
        data: fileParam,
        method: 'post'
    })
}

//删除图片信息
export const deleteFile = (fileList,path='',config) => {
    let url = `/${path==''?getUri('image'):path}${config||'/upload/deleteFile'}`
    return axios.request({
        url,
        data: fileList,
        method: 'post'
    })
}

//下载图片
export const downloadFile = (fileList,path='') => {
    return axios.request({
        url:`/${path==''?getUri('image'):path}/audit/zipDownloadFile`,
        data: fileList,
        method: 'post',
        responseType:"blob"
    })
}
export const checkFile = (initParam,path='',config) => {
    return axios.request({
        url: `/${path==''?getUri('image'):path}${config||'/upload/checkFile'}`,
        data: initParam,
        method: 'post'
    })
}
export const revolveFile = (file,path='',config) => {
    return axios.request({
        url: `/${path==''?getUri('image'):path}${config||'/upload/revolveFile'}`,
        data: file,
        method: 'post'
    })
}

